<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023-08-28
  Time: 9:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <form id="myForm">
        快递公司：
        <select name="code" id="code">
            <option value="shunfeng">顺丰</option>
            <option value="zhongtong">中通</option>
            <option value="yuantong">圆通</option>
            <option value="shentong">申通</option>
            <option value="ems">EMS</option>
            <option value="jd">京东</option>
            <option value="zhaijisong">宅急送</option>
            <option value="debangkuaidi">德邦快递</option>
            <option value="shansong">闪送</option>
            <option value="huitongkuaidi">汇通快递</option>
            <option value="jito">极兔</option>
        </select>
        快递单号：
        <input name="num" type="text" ID="num"/>
        <input type="button" value="查询" onclick="chaxun()">
    </form>
    <%--展示物流信息区域--%>
    <ul id="show">
    </ul>
</body>
</html>
<script src="js/jquery.js"></script>
<script>
    function chaxun() {
        //清空
        $("#show").empty();
        //ajax查询
        $.getJSON("QueryTrackServlet?code="+$("#code").val()+"&num="+$("#num").val(),function (data) {
            console.log(data);
            $(data.data).each(function (index,ele) {
                var li=$("<li>"+ele.time+" "+ele.context+"</li>");
                $("#show").append(li);
            })
        })
    }
</script>
